﻿using System.Diagnostics;
using System.IO;
using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
using ConsoleWeb;
using JHService;
using Microsoft.AspNetCore.Hosting;
using Service.Mqtt;
using Service.Socket;

namespace TcpService
{
    public class Services
    {
        private readonly Socket_RSServer _socketRsServer;
        private readonly MqttServerService _mqtt;
        private readonly HttpProgram _httpProgram;

        public Services(Socket_RSServer socketRsServer, MqttServerService mqtt, HttpProgram httpProgram)
        {
            _socketRsServer = socketRsServer;
            _mqtt = mqtt;
            _httpProgram = httpProgram;
        }
        public void StartAsync()
        {
            Task.Run(() => _socketRsServer.Start());
            Task.Run(() => _mqtt.Start());
            Task.Run(() => _httpProgram.StartHttpService());




            Wait();
        }



        public void Wait()
        {
        
            while (true)
            {
                //Thread.Sleep(500);
            }
        }
    }
}
